package com.fline.simplesys.controller;

import java.util.HashMap;
import java.util.Map;

import com.fline.simplesys.entity.SxQqzbGdsb;
import com.fline.simplesys.service.impl.SxYqzbService;
import com.github.pagehelper.Page;
import com.fline.simplesys.vo.TableResultResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author yangjf
 * @version 0.1.0
 * @time 2020/2/7
 */

@RestController
public class YqzbController {

    @Autowired
    private SxYqzbService sxYqzbService;

    @PostMapping("/gdsb/list")
    public TableResultResponse list(@RequestParam("page") Integer page,
                                    @RequestParam("size") Integer size,
                                    @RequestParam(value = "xm", required = false) String xm,
                                    @RequestParam(value = "sbqx", required = false) String sbqx,
                                    @RequestParam(value = "sfzh", required = false) String sfzh,
                                    @RequestParam(value = "gkzt", required = false) String gkzt,
                                    @RequestParam(value = "glfs", required = false) String glfs,
                                    @RequestParam(value = "bq", required = false) String bq) {
        Map<String, Object> param = new HashMap<>();
        param.put("xm", xm);
        param.put("sbqx", sbqx);
        param.put("sfzh", sfzh);
        param.put("gkzt", gkzt);
        param.put("glfs", glfs);
        param.put("bq", bq);
        Page<SxQqzbGdsb> pages = sxYqzbService.selectList(page, size, param);
        return new TableResultResponse(pages.getTotal(), pages);
    }
}
